#ifndef CORESETTINGS_HPP
#define CORESETTINGS_HPP

#include <string>
#include <map>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include "coreconfigdefs.hpp"

namespace pland
{

class Settings
{
public:
    static Settings* Instance();
    void setPort(uint port);
    bool setSetting(std::string key, std::string value);
    std::string getSetting(std::string key);
    bool isSet(std::string key);
    std::string erase(std::string key);
    void clear();
    bool start();
    bool stop();
private:
    Settings();
    Settings(Settings const&);
    Settings & operator=(Settings const&);
    static Settings* _instance;

    std::map <std::string, std::string> _settings;
    boost::shared_mutex mutex_;
    bool running_;
    boost::thread listener_;
    void start_();
    uint port_;
};

}
#endif // CORESETTINGS_HPP
